@@ -59,8 +59,9 @@ module Agents |
||
59 | 59 |
'type' => "html", |
60 | 60 |
'mode' => "on_change", |
61 | 61 |
'extract' => { |
62 |
- 'url' => {'css' => "#comic img", 'attr' => "src"}, |
|
63 |
- 'title' => {'css' => "#comic img", 'attr' => "title"} |
|
62 |
+ 'url' => { 'css' => "#comic img", 'attr' => "src" }, |
|
63 |
+ 'title' => { 'css' => "#comic img", 'attr' => "alt" }, |
|
64 |
+ 'hovertext' => { 'css' => "#comic img", 'attr' => "title" } |
|
64 | 65 |
} |
65 | 66 |
} |
66 | 67 |
end |
@@ -32,7 +32,8 @@ unless user.agents.where(:name => "XKCD Source").exists? |
||
32 | 32 |
'expected_update_period_in_days' => 5, |
33 | 33 |
'extract' => { |
34 | 34 |
'url' => { 'css' => "#comic img", 'attr' => "src" }, |
35 |
- 'title' => { 'css' => "#comic img", 'attr' => "title" } |
|
35 |
+ 'title' => { 'css' => "#comic img", 'attr' => "alt" }, |
|
36 |
+ 'hovertext' => { 'css' => "#comic img", 'attr' => "title" } |
|
36 | 37 |
} |
37 | 38 |
}).save! |
38 | 39 |
end |
@@ -11,8 +11,9 @@ describe Agents::WebsiteAgent do |
||
11 | 11 |
'url' => "http://xkcd.com", |
12 | 12 |
'mode' => 'on_change', |
13 | 13 |
'extract' => { |
14 |
- 'url' => {'css' => "#comic img", 'attr' => "src"}, |
|
15 |
- 'title' => {'css' => "#comic img", 'attr' => "title"} |
|
14 |
+ 'url' => { 'css' => "#comic img", 'attr' => "src" }, |
|
15 |
+ 'title' => { 'css' => "#comic img", 'attr' => "alt" }, |
|
16 |
+ 'hovertext' => { 'css' => "#comic img", 'attr' => "title" } |
|
16 | 17 |
} |
17 | 18 |
} |
18 | 19 |
@checker = Agents::WebsiteAgent.new(:name => "xkcd", :options => @site, :keep_events_for => 2) |
@@ -21,7 +22,6 @@ describe Agents::WebsiteAgent do |
||
21 | 22 |
end |
22 | 23 |
|
23 | 24 |
describe "#check" do |
24 |
- |
|
25 | 25 |
it "should validate the integer fields" do |
26 | 26 |
@checker.options['expected_update_period_in_days'] = "nonsense" |
27 | 27 |
lambda { @checker.save! }.should raise_error; |
@@ -110,7 +110,8 @@ describe Agents::WebsiteAgent do |
||
110 | 110 |
@checker.check |
111 | 111 |
event = Event.last |
112 | 112 |
event.payload['url'].should == "http://imgs.xkcd.com/comics/evolving.png" |
113 |
- event.payload['title'].should =~ /^Biologists play reverse/ |
|
113 |
+ event.payload['title'].should == "Evolving" |
|
114 |
+ event.payload['hovertext'].should =~ /^Biologists play reverse/ |
|
114 | 115 |
end |
115 | 116 |
|
116 | 117 |
it "should turn relative urls to absolute" do |
@@ -239,8 +240,9 @@ describe Agents::WebsiteAgent do |
||
239 | 240 |
'url' => "http://www.example.com", |
240 | 241 |
'mode' => 'on_change', |
241 | 242 |
'extract' => { |
242 |
- 'url' => {'css' => "#comic img", 'attr' => "src"}, |
|
243 |
- 'title' => {'css' => "#comic img", 'attr' => "title"} |
|
243 |
+ 'url' => { 'css' => "#comic img", 'attr' => "src" }, |
|
244 |
+ 'title' => { 'css' => "#comic img", 'attr' => "alt" }, |
|
245 |
+ 'hovertext' => { 'css' => "#comic img", 'attr' => "title" } |
|
244 | 246 |
}, |
245 | 247 |
'basic_auth' => "user:pass" |
246 | 248 |
} |